package com.itjiange.exception;

import com.itjiange.common.ErrorCode;

/**
 * 自定义异常类
 *
 * @author ItJiange
 * @date 2023/10/28
 */
public class BusinessException extends RuntimeException {
    /**
     * 错误码
     */
    private final int code;
    public BusinessException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }
    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }
}
